package com.chinaedu.oc.action.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.chinaedu.oc.constant.Constant;
import com.chinaedu.oc.po.dto.PubOutputDto;
import com.chinaedu.oc.service.cache.ProductLineCacheServ;
import com.chinaedu.oc.service.cache.StaticCacheServ;
import com.chinaedu.oc.util.http.HttpRequestException;

@Controller
@RequestMapping("/cache")
public class RefreshCacheAction {
	
	@Autowired
	StaticCacheServ cacheServ;
	@Autowired
	ProductLineCacheServ productLineCacheServ;
	
	@RequestMapping("/refresh")
	@ResponseBody
	public PubOutputDto refush() throws HttpRequestException {
		cacheServ.setCache();
		productLineCacheServ.addCache();
		
		PubOutputDto out = new PubOutputDto();
		out.setStatus(Constant.TRUE);
		
		return out;
	}
}
